<?php

namespace App\Http\Controllers\api;

use App\Order;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class OrderController extends Controller
{
    //保存订单数据
    public function save(Request $request){



        // {venue_id,order_date,[{sn,time},{sn,time},{sn,time},]}

        foreach($request->items as $item){

            $order = new Order();
            $order->user_id = \Auth::id();
            $order->venue_id = $request->venue_id;
            $order->order_date = $request->order_date;
            //$order->order_date = "2019-07-18";
            $order->sn = $item["sn"];
            $order->time = $item["time"];

            $order->save();

        }

        return response()->json(["code"=>200]);


    }
}
